<template>
	<div>
		<h1>vuex 测试</h1>
		Clicked: {{ getCount }} times
		cont: {{ getContent }} ..
		<button @click="increment">+</button>
		<button @click="decrement">-</button>
		<button @click="updateMessage('11112222')">0</button>
	</div>
</template>

<script>
    import { mapGetters } from 'vuex'
    import { mapActions } from 'vuex'

    export default {
        data () {
            return {
                content: ''
			}
		},
        computed: {
            // 使用对象展开运算符将 getters 混入 computed 对象中
            ...mapGetters([
                'getCount',
				'getContent'
                // ...
            ])
        },
        methods: {
            ...mapActions([
                'increment', // 映射 this.increment() 为 this.$store.dispatch('increment')
                'decrement',
                'changeContent'
            ]),
            updateMessage (e) {
                this.$store.commit('changeContent', e)
            }
            //...mapActions({
            //  add: 'increment' // 映射 this.add() 为 this.$store.dispatch('increment')
            //})
        }
    }

</script>